
public class QuadraticEquation {
	
		private double a,b,c;
		ComplexNumber root1,root2;
		int numRoots;
		
		public QuadraticEquation(double a,double b,double c){
			this.a = a;
			this.b = b;
			this.c = c;
			if (a==0){
				if (b==0){
					numRoots = 0;
				}
				else {
					numRoots = 1;
					root1 = new ComplexNumber(-c/b,0);
				}
			} else {
				double d = b*b - (4*a*c);
				if (d==0) {
					numRoots = 1;
					root1 = new ComplexNumber ((-b)/(2*a),0);
				} else {
					if (d < 0 ){
						numRoots = 2;
						root1 = new ComplexNumber ((-b)/(2*a),Math.sqrt(-d)/(2*a));
					}else {
						// where d >0
					}
				}
				
			}
			
		}

		public ComplexNumber getFirstRoot(){
			return root1;
		}
		
		public ComplexNumber getSecondRoot(){
			return root2;
		}
		
		public double getNumRoots(){
			return numRoots;
		}
		

}
